<template>
	<view class="container">
		<view class="inner">
			<view class="share-list">
				<view class="share-item" v-for="(item,index) in helpList" :key="index">
					<image v-if="item.headPic" class="share-img" :src="item.headPic"></image>
					<image v-else class="share-img" src="@/static/new/user/default-head.png"></image>
					<view class="desc">
						<text class="share-name">{{ item.nickName || '--' }}</text>
						<text class="share-time">{{ item.createdAt }}</text>
					</view>
					<view class="state" :class="{ 'is-success': item.isSuccess === 1 }">
						{{ item.isSuccess === 1 ? '已助力' : '未助力' }}
					</view>
				</view>
			</view>
			<gzListNull :list="helpList"></gzListNull>
		</view>
	</view>
</template>

<script setup>
	import { onLoad } from '@dcloudio/uni-app'
	import { ref } from 'vue'
	import { $activityHelpRecords } from '@/http/apiManager.js'
	
	onLoad(({ activityHelpId }) => {
		getHelpList(activityHelpId)
	})
	
	// 助力列表
	const helpList = ref([])
	
	// 请求分享记录
	async function getHelpList(activityHelpId){
		uni.showLoading({ title: '加载中...' })
		const { bizData } = await $activityHelpRecords({activityHelpId})
		uni.hideLoading()
		helpList.value = bizData
	}
	
</script>

<style lang="less" scoped>
	.container{
		background-color: #F7F8FC;
		width: 100%;
		min-height: 100vh;
		.inner{
			padding: 40rpx 32rpx;
			.share-list{
				display: flex;
				flex-wrap: wrap;
				gap: 40rpx;
				.share-item{
					width: 100%;
					background-color: #fff;
					border-radius: 20rpx;
					display: flex;
					gap: 24rpx;
					padding: 24rpx;
					box-sizing: border-box;
					justify-content: space-between;

					.share-img{
						width: 120rpx;
						height: 120rpx;
						border-radius: 18rpx;
					}
					
					.desc{
						display: flex;
						flex-direction: column;
						justify-content: space-around;
						flex-grow: 1;
						.share-name{
							font-weight: 500;
							
						}
						.share-time{
							font-size: 28rpx;
							color: #999999;
						}
					}
					.state{
						align-self: center;
						color: #999999;
						background-color: #F5F5F5;
						padding: 8rpx 12rpx;
						border-radius: 8rpx;
						font-size: 28rpx;
						display: flex;
						align-items: center;
						gap: 4rpx;
						&::before{
							content: '';
							display: inline-block;
							width: 28rpx;
							height: 28rpx;
							background-size: 100% 100%;
							background-position: 0 0;
							background-repeat: no-repeat;
							background-image: url('https://jdyd-marketing-public.oss-cn-hangzhou.aliyuncs.com/yx/c793212e-6698-4fdc-858d-0ce4eaf2c947.png');
						}
						&.is-success{
							color: #24C789;
							background-color: #EAFAF4;
							&::before{
								background-image: url('https://jdyd-marketing-public.oss-cn-hangzhou.aliyuncs.com/yx/fb06d503-f4bd-4534-aa98-fcd977729f0a.png');
							}
						}
					}
				}
			}
		}
	}
</style>